package com.jiangjiang.eshop.membership.dto;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.logging.log4j.util.Strings;

import java.util.Date;

/**
 * @ClassName UserDetailDTO
 * @Description TODO
 * @Author jhw
 * @Date 2021/8/21 12:50
 * @Version 1.0
 **/
@Data
public class UserDetailDTO {
    /**
     * id
     */
    private Long id;
    /**
     * 用户账号id
     */
    private Long userAccountId;
    /**
     * 姓名
     */
    private String name;
    /**
     * 性别
     */
    private Integer gender;
    /**
     * 生日
     */
    private Date birthday;
    /**
     * 身份证号
     */
    private String idNumber;
    /**
     * 住址
     */
    private String address;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date gmtCreate;
    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date gmtModified;


    public void paramCheck(){
        if(Strings.isEmpty(name)){
            throw new RuntimeException("用户姓名不能为空");
        }
        if(gender == null){
            throw new RuntimeException("用户性别不能为空");
        }

        if(Strings.isEmpty(idNumber)){
            throw new RuntimeException("身份证号不能为空");
        }

        if(Strings.isEmpty(address)){
            throw new RuntimeException("用户住址不能为空");
        }
    }
}
